/* Copyright 2012 Dustin Mitchell <dmmitche [at] gmail [dot] com>
 *
 * Licensed under the GPLv3.  See included LICENSE.txt for full details.
 */

#ifndef __LOG__
#define __LOG__

#ifdef ARM
# include <syslog.h>

/* Available levels:
 *   LOG_EMERG
 *   LOG_ALERT
 *   LOG_CRIT
 *   LOG_ERR
 *   LOG_WARNING
 *   LOG_NOTICE
 *   LOG_INFO
 *   LOG_DEBUG
 */
# define log(lvl,msg,...) \
  syslog(LOG_CRON|lvl,"(beaglebot) %s[%d]: " msg, \
    __FILE__, __LINE__, ##__VA_ARGS__)
#else /* ARM */
# include <stdio.h>

# define log(lvl,msg,...) \
  fprintf(stderr, #lvl " %s[%d]: " msg "\n", \
    __FILE__, __LINE__, ##__VA_ARGS__)
#endif /* ARM */

#endif /* __LOG__ */
